package com.cacshanghai.cac_oa_client.ui;

import android.app.Fragment;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.cacshanghai.cac_oa_client.R;

/**
 * Created by geyh on 2016/5/31.
 */
public class HomePageBaseFragment extends Fragment {

    void setTitle(String title) {
        TextView tv_title = (TextView) getView().findViewById(R.id.tv_title);
        tv_title.setText(title);
    }

    void setTitle(int resId) {
        TextView tv_title = (TextView) getView().findViewById(R.id.tv_title);
        tv_title.setText(resId);
    }

    void setTitleBackgroundColor(int resId) {
        getView().findViewById(R.id.rl_title).setBackgroundResource(resId);
    }

    /**
     * 设置标题点击跳转的页面
     */
    void setTitleOnClickToPage(final Class<?> activityClass) {
        getView().findViewById(R.id.rl_title).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), activityClass);
                startActivity(intent);
            }
        });

    }

}
